package com.mall.api.order.fallback;

import com.mall.api.order.OrderFeignClient;
import com.mall.api.order.dto.OrderDTO;
import com.mall.common.result.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class OrderFeignFallback implements OrderFeignClient {

    @Override
    public Result<OrderDTO> createOrder(OrderDTO orderDTO) {
        log.error("订单服务调用失败，进入熔断降级处理，createOrder，userId: {}", orderDTO.getUserId());
        return Result.error(500, "订单服务不可用");
    }

    @Override
    public Result<OrderDTO> getOrderById(Long id) {
        log.error("订单服务调用失败，进入熔断降级处理，getOrderById，id: {}", id);
        return Result.error(500, "订单服务不可用");
    }

    @Override
    public Result<OrderDTO> getOrderByUserId(Long userId) {
        log.error("订单服务调用失败，进入熔断降级处理，getOrderByUserId，userId: {}", userId);
        return Result.error(500, "订单服务不可用");
    }

    @Override
    public Result<Void> updateOrderStatus(Long id, Integer status) {
        log.error("订单服务调用失败，进入熔断降级处理，updateOrderStatus，id: {}, status: {}", id, status);
        return Result.error(500, "订单服务不可用");
    }

    @Override
    public Result<Void> deleteOrder(Long id) {
        log.error("订单服务调用失败，进入熔断降级处理，deleteOrder，id: {}", id);
        return Result.error(500, "订单服务不可用");
    }
} 